﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using StoreIGet.Applications.Command;
using StoreIModels;
using StoreRepositorys.Interface;

namespace StoreIGet.Controllers
{
    /// <summary>
    /// 上传图片
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class PicturesController : ControllerBase
    {
        public readonly IMediator _Mediator;
        public PicturesController(IMediator mediator)
        {
            _Mediator = mediator;
        }

        /// <summary>
        /// 显示
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<List<PictureModel>> GetPicture(PictureShowCommand command)
        {
            return await _Mediator.Send(command);
        }

        /// <summary>
        /// 反填
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<PictureModel> BackPicture(PictureBackCommand command)
        {
            return await _Mediator.Send(command);
        }
    }
}
